﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MeetingStatusSet.aspx.cs"
    Inherits="Meeting.Web.Admin.MeetingSet.MeetingStatusSet" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>会议状态管理</title>
    <link rel="stylesheet" type="text/css" href="../../Scripts/themes/cupertino/easyui.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/themes/icon.css" />
    <link rel="stylesheet" type="text/css" href="../../Css/main.css" />
    <script type="text/javascript" src="../../Scripts/jquery-1.8.2.min.js"></script>
    <script type="text/javascript" src="../../Scripts/jquery.easyui.min.js"></script>
          <script type="text/javascript" src="../../Scripts/locale/easyui-lang-zh_CN.js"></script>
    <!--ardialog-->
    <script type="text/javascript" src="../../Scripts/artDialog4.1.6/artDialog.js?skin=blue"></script>
    <script type="text/javascript" src="../../Scripts/artDialog4.1.6/plugins/iframeTools.js"></script>
    <script type="text/javascript" src="../../Scripts/common.js"></script>
    <script type="text/javascript">

        $(function () {
            if (request("psnID") == "") window.location = defaultUrl;
            //初始化列表
            $('#mainList').datagrid({
                url: 'MeetingOperation.ashx?method=GetAllMeeting',
                singleSelect: true,
                pagination: true, //是否开启分页
                pageNumber: 1, //默认索引页
                pageSize: 20, //默认一页数据条数
                collapsible: false
            });
            //设置分页
            var p = $("#mainList").datagrid("getPager");
            $(p).pagination({
                pageSize: 20, //每页显示的记录条数，默认为10   
                pageList: [10, 20, 30], //可以设置每页记录条数的列表   
                beforePageText: '第', //页数文本框前显示的汉字   
                afterPageText: '页    共 {pages} 页',
                displayMsg: '当前显示 {from} - {to} 条记录   共 {total} 条记录'
            });
        });
        //
        function DoSearch() {
            $('#mainList').datagrid('reload', {
                Name: $("#fName").val(),
                Host: $("#Host").val(),
                Begin: $("#txtBeginTime").val(),
                End: $("#txtEndTime").val()
            });
        }

       
    </script>
      <style type="text/css">
          input{ height:18px;}
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <table class="SearchTable">
        <tr>
            <td>
                名称:
            </td>
            <td>
                <input id="fName" style="width: 120px;" class="easyui-validatebox" />
            </td>
            <td>
                主持:
            </td>
            <td>
                <input id="Host" type="text" class="easyui-validatebox" style="width: 120px" />
            </td>
            <td>
                开始时间:
            </td>
            <td>
                <input id="txtBeginTime" class="easyui-datebox" style="width: 120px" data-options="formatter:myformatter,parser:myparser"
                    type="text" />
            </td>
            <td>
                ~
            </td>
            <td>
                <input id="txtEndTime" class="easyui-datebox" style="width: 120px" data-options="formatter:myformatter,parser:myparser"
                    type="text" />
            </td>
            <td>
                <a href="#" class="easyui-linkbutton" onclick="DoSearch();">查询</a>
            </td>
        </tr>
    </table>
    <div style="min-height: 500px; text-align: left;">
        <table id="mainList" class="easyui-datagrid" style="width: 1000px;">
            <thead>
                <tr>
                    <th data-options="field:'Name',width:120">
                        会议名称
                    </th>
                    
                    <th data-options="field:'RoomName',width:120 ">
                        会议室
                    </th>
                    <th data-options="field:'StartDate',width:120 ">
                        开始时间
                    </th>
                    <th data-options="field:'EndDate',width:120">
                        预计结束时间
                    </th>
                    <th data-options="field:'HostName',width:120 ">
                        会议主持
                    </th>
                    <th data-options="field:'Status',width:60,formatter:formatStatus ">
                        会议状态
                    </th>
                    <th data-options="field:'actionColumn',width:120,formatter:formatStatusCmd">
                        状态修改
                    </th>
                </tr>
            </thead>
        </table>
        <script type="text/javascript">
            function formatStatus(val, row) {
                if (val == 1) return "准备";
                if (val == 2) return "激活";
                if (val == 3) return "取消";
                if (val == 4) return "关闭";
            }
            function formatStatusCmd(val, row,index) {
                return "<a href='#' class='easyui-linkbutton' onclick=\"AlterStatus('" + row.Id + "',1," +index+");\"  >准备</a> "
                       + "<a href='#' class='easyui-linkbutton' onclick=\"AlterStatus('" + row.Id + "',2," +index+");\"  >激活</a> "
                       + "<a href='#' class='easyui-linkbutton'  onclick=\"AlterStatus('" + row.Id + "',3," +index+");\">取消</a> "
                       + "<a href='#' class='easyui-linkbutton' onclick=\"AlterStatus('" + row.Id + "',4," +index+");\" >关闭</a> ";
            }
          
            function AlterStatus(Id, status,index) {
                $.messager.confirm("确认", "您确定要执行操作吗？", function (data) {
                    if (data) {
                        $.post("MeetingOperation.ashx?method=AlterStatus", { Id: Id, Status: status }, function (data) {
                            if (data.success == true) {
                                $('#mainList').datagrid('updateRow', {
                                    index: index,
                                    row: {
                                        Status: status
                                    }
                                });
                                $.messager.alert("提示", "修改成功"); 
                            } else { 
                            $.messager.alert("提示", data.Message);
                            }
                        });
                    }
                });
            }
        </script>
    </div>
    </form>
</body>
</html>
